package ch.uzh.ifi.seal.ssqa.perspectives;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

import ch.uzh.ifi.seal.ssqa.ui.views.ArchitectureAnalysisView;
import ch.uzh.ifi.seal.ssqa.ui.views.ChangeCouplingView;
import ch.uzh.ifi.seal.ssqa.ui.views.ElementMetricsView;
import ch.uzh.ifi.seal.ssqa.ui.views.FileModelView;
import ch.uzh.ifi.seal.ssqa.ui.views.MetricSelectionView;
import ch.uzh.ifi.seal.ssqa.ui.views.NumericMetricTableView;
import ch.uzh.ifi.sonar.views.DashboardView;

public class AnalysisPerspectiveFactory implements IPerspectiveFactory {

	private IPageLayout layout;
	
	@Override
	public void createInitialLayout(IPageLayout layout) {
		this.layout = layout;
		this.addViews();
	}
	
	private void addViews() {
		this.layout.setEditorAreaVisible(false);
		this.layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT,0.15f, layout.getEditorArea());
		this.layout.addView(MetricSelectionView.ID, IPageLayout.BOTTOM,0.5f, IPageLayout.ID_PROJECT_EXPLORER);
		this.layout.addView(NumericMetricTableView.ID, IPageLayout.BOTTOM,0.5f, MetricSelectionView.ID);
	
		IFolderLayout analysisViews = layout.createFolder("Analysis", IPageLayout.RIGHT, 0.85f, layout.getEditorArea());
		analysisViews.addView(ArchitectureAnalysisView.ID);
		analysisViews.addView(ChangeCouplingView.ID);
		analysisViews.addView(ElementMetricsView.ID);
		analysisViews.addView(FileModelView.ID);
		analysisViews.addView(DashboardView.ID);
	}
}
